import http from '../utils/HttpUtil';
import * as $ from '../utils/HHUtil';

export function getAll() {
  return http({
    url: '/sei/group/getAllInTable',
    method: 'get'
  });
}

export function create(params) {
  return http.put(
    '/sei/group',
    params
  );
}

export function finish(params) {
  return http(
    {
      url: '/sei/group/finish',
      data: params,
      method: 'post'
    }
  );
}

export function restart(params) {
  return http.post(
    '/sei/group/restart',
    params,
  );
}

export function getGroupsInfo() {
  return http.get(
    '/sei/group/getGroupsInfoInTable'
  );
}

export function getMembers(params) {
  return http.get('/sei/group/getMembersInTable',
    {
      params
    }
  );
}

export function addMember(params) {
  console.log(params);
  return http.post(
    '/sei/group/addMember',
    params,
  );
}

export function getGroupInfo(params) {
  return http.get(
    '/sei/group',
    {
      params
    }
  );
}

export function removeMember(params) {
  return http.post(
    '/sei/group/removeMember',
    {
      params
    }
  );
}

export function setAsAdmin(params) {
  return http.post(
    '/sei/group/setAsAdmin',
    {
      params
    }
  );
}

export function setSubscribe(params) {
  return http.post(
    '/sei/group/setSubscribe',
    params
  );
}

export function getMyGroupList() {
  return http.get(
    '/sei/group/getMyGroupList'
  );
}

export function getAllPostersOfGroupInWeek(params) {
  return http.get(
    '/sei/group/getAllPostersOfGroupInWeek',
    {
      params
    }
  );
}

export function getAllMembers(params) {
  return http.get(
    '/sei/group/getAllMembers',
    {
      params
    }
  );
}

export function setPostTemplate(params) {
  return http({
      url: '/sei/group/setPostTemplate',
      data: params,
      method: 'post'
    }
  )
}

export function setNeedSubmit(params){
  return http({
    url: '/sei/group/setNeedSubmit',
    data: params,
    method: 'post'
  });
}
